package cn.lyjuan.dwz_manage.core.java.filter;

import cn.lyjuan.dwz_manage.core.java.cst.DwzManageCst;
import cn.lyjuan.dwz_manage.core.java.cst.TypeCst;

import javax.servlet.*;
import java.io.IOException;

/**
 * 给 HttpServletRequest增加必要的资源
 * Created by chad on 2016/9/12.
 */
public class RequestAttributesFilter implements Filter
{
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
    {
        // 请求后缀
        servletRequest.setAttribute(TypeCst.RequestAttributes.HTTP_SUFFIX_NAME, DwzManageCst.httpSuffix);

        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException
    {

    }

    @Override
    public void destroy()
    {

    }
}
